//
//  UserProjectTableViewCell.m
//  XinKaiFa55like
//
//  Created by junseek on 2017/3/24.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "UserProjectTableViewCell.h"
#import "UILabel+atrribulttext.h"

@interface UserProjectTableViewCell (){    //
    
    NSIndexPath *tempIndexPath;
    NSDictionary *tempDic;
    
    UIView *viewBg;
    UILabel *lblTitle;
    UILabel *lblContent;
    UILabel *lblDate;
    
    UILabel *lblprogress;
    
    UIImageView *imageRedTip;
}

@end
@implementation UserProjectTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        viewBg=[[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 50)];
        [viewBg setBackgroundColor:RGBCOLOR(255, 255, 255)];
        [self addSubview:viewBg];
        
        lblTitle=[RHMethods labelWithFrame:CGRectMake(10, 10, W(viewBg)-30, 20) font:fontTitle color:rgbTitleColor text:@""];
        [viewBg addSubview:lblTitle];
        
        imageRedTip=[RHMethods imageviewWithFrame:CGRectMake(W(viewBg)-17, 7, 7, 7) defaultimage:@"redTip070116" contentMode:UIViewContentModeScaleAspectFit];
        [viewBg addSubview:imageRedTip];
        imageRedTip.hidden=YES;
        
        lblContent=[RHMethods labelWithFrame:CGRectMake(10, YH(lblTitle), W(viewBg)-20, 20) font:fontTxtContent color:rgbTxtDeepGray text:@""];
        [viewBg addSubview:lblContent];
        
        lblDate=[RHMethods labelWithFrame:CGRectMake(10, YH(lblContent), W(viewBg)-33, 15) font:fontSmallTitle color:rgbTxtGray text:@""];
        [viewBg addSubview:lblDate];
        
        lblprogress=[RHMethods labelWithFrame:CGRectMake(10, YH(lblDate), W(viewBg)-20, 30) font:fontTxtContent color:rgbpublicColor text:@""];
        [viewBg addSubview:lblprogress];
        
        viewBg.frameHeight=YH(lblprogress);
        [viewBg addSubview:[RHMethods lineViewWithFrame:CGRectMake(0, 0, kScreenWidth, 0.5)]];
        [viewBg addSubview:[RHMethods lineViewWithFrame:CGRectMake(0, viewBg.frameHeight-0.5, kScreenWidth, 0.5)]];
        
        
        [self setSelectionStyle:UITableViewCellSelectionStyleGray];
    }
    return self;
}

//内容更新
-(void)setValueForDictionary:(NSDictionary *)dic indexPath:(NSIndexPath *)indexPath type:(NSString *)strType{
    tempIndexPath=indexPath;
    tempDic=dic;
    
    NSString *strTitle=[NSString stringWithFormat:@"%@",[dic valueForJSONStrKey:@"prjname"]];
    lblTitle.text=strTitle;
    
    lblContent.text=[NSString stringWithFormat:@"%@ | %@ | %@ | %@",[dic valueForJSONStrKey:@"typename"],[dic valueForJSONStrKey:@"regtime"],[dic valueForJSONStrKey:@"money"],[dic valueForJSONStrKey:@"principal"]];
    lblDate.text=[dic valueForJSONStrKey:@"ctime"];
    
    lblprogress.text=[NSString stringWithFormat:@"项目进度：%@(%@/%@)",[dic valueForJSONStrKey:@"stepname"],[dic valueForJSONStrKey:@"stepsort"],[dic valueForJSONStrKey:@"total"]];
    [lblprogress setColor:rgbTitleColor contenttext:@"项目进度："];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
